<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>满标待放款详细列表</title>

<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/select2_metro.css" />
<link rel="stylesheet"
	href="${ctx}/resources/media/css/DT_bootstrap.css" />
<link rel="stylesheet" href="${ctx}/resources/media/css/dialog.css" />

</head>
<body>
	<div class="row-fluid profile">
		<div class="span12">
			<!--BEGIN TABS-->
			<div class="tabbable tabbable-custom tabbable-full-width">
				<ul class="nav nav-tabs">
					<li><a href="${ctx}/audit/fullscale/loan">满标待放款列表</a></li>
					<li class="active"><a>满标待放款详细列表</a></li>
				</ul>
				<div class="tab-content">
					<div class="alert alert-block alert-warning fade in hide">
						<button type="button" class="close" data-dismiss="alert"></button>
						<h4 class="alert-heading">请注意!</h4>
						<p>
							你正在执行一个删除操作，你将删除被标记为"<strong style="color: red" class="title">站点标题</strong>"的数据。
							<br />请确保你知晓执行该操作的后果，该操作不可恢复！
						</p>
						<p>
							<a class="btn red cconfirm" href="javascript:;">继续删除</a> <a
								class="btn blue cclose" href="javascript:;">放弃操作</a>
						</p>

					</div>
					<div class="tab-pane row-fluid active" id="tab_1_1">
						<div class=" responsive" data-tablet="span12 fix-offset">
							<!-- BEGIN EXAMPLE TABLE PORTLET-->
							<div class="portlet box grey">
								<div class="portlet-title">
									<div class="caption">
										<i class="icon-list"></i>满标待放款详细列表
									</div>
								</div>
								<div class="portlet-body">
									<div class="row-fluid">
										<div class="span12 ">
											<input type="text" placeholder="姓名" id="memberName"
												class="m-wrap normal">
												<input type="hidden" name="financingId" id="financingId" value="${financingId }">
												<input type="hidden" id="id" />
											<button class="btn blue" onclick="search()">
												<i class="icon-search"></i> 搜索
											</button>

										</div>
									</div>
									<table class="table table-striped table-bordered table-hover " 
										id="dataTable">
										<thead>
											<tr>
												<th>会员姓名</th>												                                   			
                                      			<th>机构名称</th>                                      			   
                                      			<th>项目名称</th>
                                      			<th>贷款金额</th>
                                      			<th>首期费用</th>
                                      			<th>手续费率</th>
                                      			<th>手续费</th>
												<th>分期数</th>
                                                <th>状态</th>
												<th style="width:140px">操作</th>
											</tr>
										</thead>
										<tbody>
											
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
					<!--end tab-pane-->
				</div>
			</div>
			<!--END TABS-->

			<div class="theme-popover">
				<div class="theme-poptit">
					<a href="javascript:;" title="关闭" class="close"></a>
					<h3>满标放款</h3>
				</div>
				<div class="theme-popbod dform">
					           <form class="theme-signin" name="loginform" >
					           	    <h1>请确定是否同意放款？</h1>
					              <input class="btn btn-primary" type="button" name="submit" value=" 确定 " onclick="dialogSubmit(2)" style="float:right;margin-right:180px;margin-top:180px;padding-bottom:28px"/>
					              <input class="btn" type="button" name="cancel" value=" 取消 " onclick="closeDialog()" style="float:right;margin-right:-150px;margin-top:180px;padding-bottom:28px"/>
					           </form>
					     </div>
			</div>
			<div class="theme-popover-mask"></div>
		</div>
	</div>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/select2.min.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.dataTables.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/DT_bootstrap.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/form-wizard.js"></script>
	<script type="text/javascript">
		var dt;

		$(function() {

			$("select").select2();
			
			dt = $('#dataTable')
			.dataTable(
					{
						"bLengthChange" : false,
						"bFilter" : true,
						"bInfo" : false,
						"iDisplayLength" : 10,
						"bSort" : false,
						"sDom" : "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
						"sPaginationType" : "bootstrap",
                        "bServerSide":true,
                        "sAjaxSource":"${ctx}/audit/fullscale/loan/loanData.json/"+$("#financingId").val(),
						"oLanguage" : {
							"oPaginate" : {
								"sPrevious" : "上一页",
								"sNext" : "下一页"
							}
						},
						"aoColumns":[
	                                    {
                                	"mData":"memberName"
                                },{
                                	"mData":"organizationName"
                                },{
                                	"mData":"projectName"
                                },{
                                	"mData":"loanAmount"
                                },{
                                	"mData":"downPaymentDeposit"
                                },{
                                	"mData":"feeRate"
                                },{
                                	"mData":"fee"
                                },{
                                	"mData":"term"
                                },{
	                                        "mData":null,
	                                        "fnRender":function(oObj){
	                                        	 var text = "";
	                                             if(oObj.aData.status == 0){
	                                                 text = "<span class='label label-success'>正常</span>";
	                                             } else if(oObj.aData.status == 1){
	                                          	   text = "<span class='label label-important'>已删除</span>";
	                                             } else if(oObj.aData.status == 2){
	                                          	   text = "<span class='label label-warning'>待审核</span>";
	                                             } else if(oObj.aData.status == 3){
	                                          	   text = "<span class='label label-inverse'>审核失败</span>";
	                                             }
	                                             return text;
	                                        }
	                                    },
										{
											"mData" : null,
											"fnRender" : function(oObj) {
												return '<a href="javascript:;" class="btn mini green" onclick="dialog('
														+ "'"
														+ oObj.aData.id
														+ "'"
														+ ')">\
                                            <i class=" icon-money"></i> 放款 \
                                    		</a>\ ';
											}
											
										} ],
										"fnServerData":function(sSource,aoData,fnCallback){
		                                    for(i in aoData){
		                                        if(aoData[i].name == "sSearch")
		                                            aoData[i].name = "memberName";
		                                    }

		                                    //aoData.push({name:'status',value:$("#status").val()});                                   
		                                    $.ajax({
		                                        "dataType":'json',
		                                        "type":'POST',
		                                        "url":sSource,
		                                        "data":aoData,
		                                        "success":fnCallback
		                                    });
		                                }
									});

			jQuery('#dataTable_wrapper .row-fluid:first').remove();
			jQuery('#dataTable_wrapper .dataTables_length select').addClass(
					"m-wrap small"); // modify table per page dropdown
		});
		
		function search(){
            dt.fnFilter($("#memberName").val());     
        }

		function dialogSubmit() {
			var id = $("#id").val();
			$.post("${ctx}/audit/fullscale/loan/commit/" + id, {
			}, function(result) {
				if (result) {
					alertBasic("提示信息","审核成功",function(){
						location.href = "";	
					},3);
				} else {
					alertBasic("提示信息","审核失败",function(){
						location.href = "";	
					},1);
				}
			}, "json")
		}

		function dialog(id) {
			$('.theme-popover-mask').fadeIn(100);
			$('.theme-popover').slideDown(200);
			$("#id").val(id);
			$('.theme-poptit .close').click(function() {
				$('.theme-popover-mask').fadeOut(100);
				$('.theme-popover').slideUp(200);
			})

		}
		
		function closeDialog() {
			$('.theme-popover-mask').fadeOut(100);
			$('.theme-popover').slideUp(200);
		}
	</script>
</body>
</html>